package com.example.mongodb.mongodb.controller;

import com.example.mongodb.mongodb.entity.User;
import com.example.mongodb.mongodb.service.InitMogodbService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class InitMongodb {


    @Autowired
    private InitMogodbService initMogodbService;

    @GetMapping("/initMongodb")
    public void initMongodb(){
        initMogodbService.setInitMogodbDao();

    }

    @GetMapping("/initMongodbUser")
    public void initMongodbUser(){
        initMogodbService.initMongodbUser();

    }


    @GetMapping("/deleteMongodb")
    public void deleteMongodb(){
        initMogodbService.deleteMongodb();

    }

    @GetMapping("/queryUserInfo")
    public List<User> queryUserInfo(){
      return   initMogodbService.queryUserInfo();
    }


}
